package com.lyn.mango;

import com.alibaba.fastjson.JSONObject;
import com.jfinal.plugin.activerecord.Model;
import com.lyn.common.base.BaseService;
import com.lyn.common.base.Result;
import com.lyn.config.Man;
import com.lyn.domain.TblDataHyydflb;

public class MangoService extends BaseService {
    public static final MangoService me = new MangoService();

    @Override
    public Model<?> getDao() {
        return TblDataHyydflb.dao;
    }

    public Result insert(String data) {
        logger.info("插入一条记录");

        TblDataHyydflb model = JSONObject.parseObject(data, TblDataHyydflb.class);
        return baseInsert(model);
    }

    //测试通过
    public Result getById(String id) {
        return baseGetById(id);
    }

    public void mangoInsert(String data) {
        MangoDao dao = Man.get().create(MangoDao.class);
        TblDataHyydflb model = JSONObject.parseObject(data, TblDataHyydflb.class);
        dao.add(model.getGuid(), model.getNian().intValue(), model.getYue().intValue(), model.getTjm(), model.getDwdm());
    }

    public void mangoGet(String dwdm) {
        MangoDao dao = Man.get().create(MangoDao.class);
        logger.info("getTotalYue()结果：{}", dao.getTotalYue(dwdm));
    }
}
